package top.yxf.mcp.server.juejing.infrastructure.gateway;

import jakarta.annotation.Resource;
import okhttp3.OkHttpClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import retrofit2.Retrofit;
import retrofit2.converter.jackson.JacksonConverterFactory;
/**
 * 掘金服务配置类
 */
@Configuration
public class JueJingServiceConfig {

    private static final String JUEJIN_API_BASE_URL = "https://api.juejin.cn/";

    @Resource
    private OkHttpClient okHttpClient;
    /**
     * 配置掘金服务接口
     *
     * @return IJueJingService实例
     */
    @Bean
    public IJueJingService jueJingService() {
        Retrofit retrofit = new Retrofit.Builder()
                .baseUrl(JUEJIN_API_BASE_URL)
                .client(okHttpClient)
                .addConverterFactory(JacksonConverterFactory.create())
                //.addConverterFactory(CustomGsonConverterFactory.create())
                .build();

        return retrofit.create(IJueJingService.class);
    }
}
